package cn.iocoder.yudao.module.forward.dal.mysql.datasource;

import java.io.Serializable;
import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.forward.dal.dataobject.datasource.DataSourceDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.forward.controller.admin.datasource.vo.*;

/**
 * 信息源 Mapper
 *
 * @author dfs
 */
@Mapper
public interface DataSourceMapper extends BaseMapperX<DataSourceDO> {

    default PageResult<DataSourceDO> selectPage(DataSourcePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DataSourceDO>()
                .likeIfPresent(DataSourceDO::getName, reqVO.getName())
                .eqIfPresent(DataSourceDO::getEnable, reqVO.getEnable())
                .betweenIfPresent(DataSourceDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DataSourceDO::getId));
    }
}